home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / tex / dvivga9.zip / MAIN.H < prev    next >
C/C++ Source or Header  |  1988-05-30  |  5KB  |  201 lines

  1. /* -*-C-*- main.h */
  2. /*-->main*/
  3. /**********************************************************************/
  4. /******************************** main ********************************/
  5. /**********************************************************************/
  6.  
  7. /**********************************************************************/
  8. /***********************  External Definitions  ***********************/
  9. /**********************************************************************/
  10.  
  11. #if    KCC_20
  12. #include <file.h>
  13. #endif /* KCC_20 */
  14.  
  15. #if    PCC_20                /* this stuff MUST be first */
  16.  
  17. #undef tops20                /* to keep definitions alive */
  18. #include <ioctl.h>            /* PCC-20 does not have this in */
  19.                     /* the others */
  20. #include <file.h>            /* need for f20open flags and */
  21.                     /* JSYS stuff */
  22. #define tops20  1            /* define for tops-20 */
  23. #endif /* PCC_20 */
  24.  
  25. #include "commands.h"
  26. #include <ctype.h>
  27. #include <math.h>
  28.  
  29. #if    BBNBITGRAPH
  30. #if    (OS_VAXVMS | IBM_PC_WIZARD | IBM_PC_LATTICE | IBM_PC_MICROSOFT)
  31.     /* not available */
  32. #else /* NOT (OS_VAXVMS | IBM_PC_WIZARD | IBM_PC_LATTICE | IBM_PC_MICROSOFT) */
  33. #include <signal.h>
  34. #endif /* (OS_VAXVMS | IBM_PC_WIZARD | IBM_PC_LATTICE | IBM_PC_MICROSOFT) */
  35. #endif /* BBNBITGRAPH */
  36.  
  37. #if    OS_UNIX
  38. #if    BSD42
  39.  
  40. #include <sys/ioctl.h>            /* need for DVISPOOL in dviterm.h */
  41.  
  42. #ifndef _NFILE
  43. /* VAX VMS, NMTCC, PCC-20, and HPUX have _NFILE in stdio.h.  V7 called
  44. it NFILE, and Posix calls it OPEN_MAX.  KCC-20 calls it SYS_OPEN.  VAX
  45. 4.3BSD and Gould UTX/32 don't define _NFILE in stdio.h; they use
  46. NOFILE from sys/param.h.  Sigh.... */
  47. #include <sys/param.h>
  48. #ifdef NOFILE
  49. #define _NFILE NOFILE            /* need for gblvars.h */
  50. #else
  51. #define _NFILE MAXOPEN            /* use our font limit value */
  52. #endif
  53. #endif
  54.  
  55. #endif /* BSD42 */
  56. #endif /* OS_UNIX */
  57.  
  58.  
  59.  
  60. #include "gendefs.h"
  61.  
  62. #if    DECLA75
  63. #undef STDMAG
  64.  
  65. #if    STDRES
  66. #define  STDMAG        720
  67. #else /* NOT STDRES */
  68. #define  STDMAG        720
  69. #endif /* STDRES */
  70.  
  71. #endif /* DECLA75 */
  72.  
  73. #if    DECLN03PLUS
  74. #undef STDMAG
  75.  
  76. #if    STDRES
  77. #define  STDMAG        1500
  78. #else /* NOT STDRES */
  79. #define  STDMAG        750
  80. #endif /* STDRES */
  81.  
  82. #endif /* DECLN03PLUS */
  83.  
  84. #if    EPSON
  85. #undef STDMAG
  86.  
  87. #if    STDRES
  88. #define  STDMAG        1200        /* use 240dpi fonts */
  89. #else /* NOT STDRES */
  90. #define  STDMAG        603        /* 1500 * 1.2**(-5) */
  91. #endif /* STDRES */
  92.  
  93. #endif /* EPSON */
  94.  
  95. #if    (HPJETPLUS | POSTSCRIPT | IMPRESS | CANON_A2)
  96. #undef STDMAG
  97.  
  98. #if    STDRES
  99. #define  STDMAG        1500        /* 300 dpi Canon LBP-CX print engine */
  100. #else /* NOT STDRES */
  101. #define  STDMAG        1440        /* near value in 1000*1.2**n family */
  102. #endif /* STDRES */
  103.  
  104. #endif /* (HPJETPLUS | POSTSCRIPT | IMPRESS | CANON_A2) */
  105.  
  106. #if    TOSHIBAP1351            /* want to override STDMAG */
  107. #undef STDMAG
  108.  
  109. #if    STDRES
  110. #define  STDMAG        868        /* 1500 * 1.2**(-3) */
  111. #else /* NOT STDRES */
  112. #define  STDMAG        833        /* 1000 * 1.2**(-1) */
  113. #endif /* STDRES */
  114.  
  115. #endif /* TOSHIBAP1351 */
  116.  
  117.  
  118. #include "gblprocs.h"
  119.  
  120. #include "gblvars.h"
  121.  
  122. #if    BBNBITGRAPH
  123. #include "keydef.h"
  124. #endif /* BBNBITGRAPH */
  125.  
  126. #if    OS_ATARI
  127. long _stksize = 20000L; /* make the stack a bit larger than 2KB */
  128.                         /* number must be even                  */
  129. #endif /* OS_ATARI */
  130.  
  131.  
  132. /**********************************************************************/
  133. /*******************************  main  *******************************/
  134. /**********************************************************************/
  135.  
  136. int
  137. main(argc, argv)
  138. int argc;
  139. char *argv[];
  140. {
  141.     register int k;        /* loop index */
  142.     register int file_args;    /* count of file arguments */
  143.  
  144.  
  145.     (void)strcpy(g_progname, argv[0]); /* save program name */
  146.  
  147.     (void)initglob();        /* do this before argc check! */
  148.  
  149. #if    OS_UNIX
  150.     /* On Unix, we allow filtering of stdin to stdout */
  151. #else /* NOT OS_UNIX */
  152.     if (argc < 2)
  153.     {
  154.     (void)usage(stderr);
  155.     (void)EXIT(1);
  156.     }
  157. #endif /* OS_UNIX */
  158.  
  159.     for (k = 1; k < argc; ++k)
  160.     {
  161.     if (*argv[k] == '-')    /* -switch */
  162.         (void)option(argv[k]);
  163.     }
  164.  
  165.     if (!quiet)
  166.     {
  167.     (void)fprintf(stderr,"[TeX82 DVI Translator Version %s]",VERSION_NO);
  168.     NEWLINE(stderr);
  169.     (void)fprintf(stderr,"[%s]",DEVICE_ID);
  170.     NEWLINE(stderr);
  171.     }
  172.  
  173.     if (npage == 0)        /* no page ranges given, make a large one */
  174.     {
  175.     page_begin[0] = 1;
  176.     page_end[0] = 32767;    /* arbitrary large integer */
  177.     page_step[0] = 1;
  178.     npage = 1;
  179.     }
  180.     else /* need font defs from postamble if only some pages to be output */
  181.     preload = TRUE;
  182.  
  183.     file_args = 0;
  184.     for (k = 1; k < argc; ++k)
  185.     {
  186.     if (*argv[k] != '-')     /* must be file argument */
  187.     {
  188.         file_args++;
  189.         (void)dvifile(argc,argv,argv[k]);
  190.     }
  191.     }
  192.  
  193. #if    OS_UNIX
  194.     if (file_args == 0)        /* use stdin/stdout instead */
  195.         (void)dvifile(argc,argv,"");
  196. #endif
  197.  
  198.     (void)alldone();        /* this will never return */
  199.     return (0);            /* never executed; avoid compiler warnings */
  200. }
  201.